$(function(){
});

function edit(){
	var userName = $('#userName').val();
	if($.trim(userName)!=""){
		$.ajax({
			url : contextPath+ 'user/companyuser/edit',
			data : {
				userName : userName
			},
			type : 'POST',
			success : function(data) {
				if(data.opResult == '0'){
					alert("修改用户资料成功");
					//location.href = contextPath + 'davigation/davigation.html';
				}else {
					alert(data.msgDesc);
				}
			}
		});
	}
}
function showChange(){
	$("#changeMobileBox").show();
}
/**
 * 发送手机验证码
 */
function getcode(){
	var mobile = $('#mobile').val();
	if(!checkMobile()){
		alert("手机号码输入错误");
	}else{
		$.ajax({
			url : contextPath+ 'user/companyuser/getcode',
			data : {
				mobile : mobile,
				type : 3
			},
			type : 'POST',
			success : function(data) {
				alert(data.msgDesc);
			}
		});
	}
}
function changeMobile(){
	var mobile = $('#mobile').val();
	var code = $('#code').val();
	var pwd = $('#pwd').val();
	if(!checkMobile()){
		alert("请输入正确的手机号码");
	}else if(code==''){
		alert("请输入验证码");
	}else if(pwd==''){
		alert("请输入密码");
	}else{
		$.ajax({
			url : contextPath+ 'user/companyuser/changemobile',
			data : {
				password:pwd,
				mobile : mobile,
				code : code
			},
			type : 'POST',
			success : function(data) {
				alert(data.msgDesc);
				window.location.reload();
			}
		});
	}
}